package com.jinghua.treatment.controller;

import com.jinghua.treatment.entity.SysSleep;
import com.jinghua.treatment.service.SysSleepService;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 睡眠情况控制器
 * Created by 王兴光 on 2018/3/26.
 */
@Controller
@RequestMapping("/Sleep")
public class SysSleepController {

    @Resource
    private SysSleepService sleepService;

    @ApiOperation(value="根据睡眠情况编号查询睡眠情况信息")
    @GetMapping(value="/getSleepById",params = {"sleepId"})
    @ResponseBody
    public SysSleep findSleepById(Integer sleepId){return sleepService.selectByPrimaryKey(sleepId);};

    @ApiOperation(value="新增睡眠情况信息")
    @GetMapping(value="/insertSleep")
    @ResponseBody
    public int insertSleep(SysSleep sleep){return sleepService.insert(sleep);};

    @ApiOperation(value="更新睡眠情况信息")
    @GetMapping(value="/updateSleep")
    @ResponseBody
    public int updateSleep(SysSleep sleep){return sleepService.updateByPrimaryKey(sleep);};
}
